package com.beiye.drivertransport.adapter;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.frame.adapter.CommonAdapter;
import com.android.frame.adapter.ViewHolder;
import com.beiye.drivertransport.R;
import com.beiye.drivertransport.bean.AppModule;
import com.squareup.picasso.Picasso;

import java.util.List;

/**
 * Created by ky on 2018/5/25.
 */


public class MaintSecondAdapter extends CommonAdapter<AppModule.RowsBean> {
    private final List<AppModule.RowsBean> mList;
    private Context context;
    // 标记用户当前选择
    private int index = -1;


    public MaintSecondAdapter(Context context, List<AppModule.RowsBean> mList, int itemLayoutId) {
        super(context, mList, itemLayoutId);
        this.context = context;
        this.mList = mList;
    }

    @Override
    public void convert(ViewHolder holder, AppModule.RowsBean item, final int position) {


        ImageView img_gv = holder.getView(R.id.img_main);
        TextView tv_main = holder.getView(R.id.tv_main);

        String url = mList.get(position).getIconUrl();
        String moduleName = mList.get(position).getModuleName();


        tv_main.setText(moduleName);
        Picasso.with(mContext).load(Uri.parse(url)).placeholder(R.mipmap.nophoto).into(img_gv);


    }


}